from typing import Optional

import reflex as rx


class StateBase(rx.State):
    """ State 基类 """

    user_id: Optional[str] = None
    current_user: str = ""

    alert_opened: bool = False

    def logout(self):
        self.current_user = ""

    def open_alert(self):
        self.alert_opened = True

    def close_alert(self):
        self.alert_opened = False
